package com.jianshuai.service.impl;

import com.jianshuai.mapper.DeviceMapper;
import com.jianshuai.service.IDeviceService;
import com.jianshuai.domain.Device;
import com.jianshuai.utils.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeviceServiceImpl implements IDeviceService {

    @Autowired
    private DeviceMapper deviceMapper;

    @Override
    public JSONResult<Device> getDeviceInfoById(Long id) {
        JSONResult<Device> deviceJSONResult = new JSONResult<>();
        Device device = deviceMapper.getDeviceInfoById(id);
        deviceJSONResult.setData(device);
        return deviceJSONResult;
    }

    @Override
    public JSONResult add(Device device) {
        deviceMapper.add(device);
        return new JSONResult();
    }

    @Override
    public List<Device> getByBuildId(Long id) {
        return deviceMapper.getByBuildId(id);
    }

    @Override
    public List<Device> getDeviceListByDeviceType(Long type) {
        return deviceMapper.getDeviceListByDeviceType(type);
    }


}
